import facade
from xjlibrary.our_file_dir import BaseDir

curPath = BaseDir.get_file_dir_absolute(__file__)
TopPath = BaseDir.get_upper_dir(curPath, -3)
dirPath = BaseDir.get_new_path(TopPath, "download", "EI", "download", "json", "AN")


class DownIndexByAN(object):
    """
    这个代码还要下载被引量和eid
    """

    def __init__(self):
        self.configfile = BaseDir.get_new_path(curPath, "db.ini")
        self.logger = facade.get_streamlogger()
        self.mysqlutils = facade.MysqlUtiles(self.configfile, "db", logger=self.logger)

    def update(self):
        sql = "update accnum set stat=0 where stat=1"
        self.mysqlutils.ExeSqlToDB(sql)
        sql = "truncate table accnumpage"
        self.mysqlutils.ExeSqlToDB(sql)


if __name__ == "__main__":
    down = DownIndexByAN()
    down.update()
